<form method="POST"><table>
    Keyword  <input type="text" name="key"> <br>
    Min Like <input type="text"name="min">  <br>
    Max Like <input type="text"name="max">  <br>
    <input type="submit"name="submit"value="Seach"> <br>
    
    <td>Company </td>
    <td><select name="Company"><br>
    
            <?php 
 require_once './model/dp2.php';
 $query ="SELECT * FROM companies";
 $companies= getpages($query);
 ?>
            <?php foreach ( $companies as $company):?>
            <option value="<?php echo $company['id']; ?>"><br>
                <?php echo $company['name'];?>
                <?php endforeach;?>
                </option>
        </select>
            </td> 
           <td>App </td>    
    <td><select name="App"> <br>
            
            <?php 
 require_once './model/dp2.php';
 $query ="SELECT * FROM apps";
 $apps= getpages($query);
 ?>
            
            <?php foreach ( $apps as $app):?>
            <option value="<?php echo $app['id']; ?>"><br>
                <?php echo $app['name'];?>
                <?php endforeach;?>
                </option>
        </select>
            </td> 
    
    
    </table>
</form>
<?php
require_once './model/dp2.php';

$query = "SELECT * FROM pages LIMIT 100";
$pages = getpages($query);
?>
<?php if (isset($_POST['submit'])): ?>
    <?php $keyword = $_POST['key']; ?>
    <?php $min = (double) $_POST['min']; ?>
    <?php $max = (double) $_POST['max']; ?>

    <table border ="1">
        <tr>
            <th>PID</th>
            <th>PICTURE</th>
            <th>ID</th>
            <th>NAME</th>
            <th>USERNAME</th>
            <th>PHONE</th>
            <th>CITY</th>
            <th>LIKE</th>

        </tr>
        <?php foreach ($pages as $page): ?>
            <?php if ((int) $_GET . $page['likes'] >= ((int) $_POST['min']) && (int) $_GET . $page['likes'] <= ((int) $_POST['max'])): ?>
                <tr>
                    <td><?php echo $page['pid'] ?></td>
                    <td><img src='<?php echo $page['picture'] ?>'></td>
                    <td><?php echo $page['id'] ?></td>
                    <td><?php echo $page['name'] ?></td>
                    <td><?php echo $page['username'] ?></td>
                    <td><?php echo $page['phone'] ?></td>
                    <td><?php echo $page['city'] ?></td> 
                    <td><?php echo $page['likes'] ?></td> 
                </tr>
            <?php endif; ?>

        <?php endforeach; ?>
    </table>
<?php endif; ?>